<html>
<head><meta charset="utf-8"><title>Overview diagram · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Overview.20diagram.html">Overview diagram</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="226249266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Overview%20diagram/near/226249266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Julian-Wollersberger <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Overview.20diagram.html#226249266">(Feb 13 2021 at 15:11)</a>:</h4>
<p><a href="/user_uploads/4715/v8tpIj6bP0te7uXwpaCo48Xv/image.DNXJY0.png">image.DNXJY0.png</a> </p>
<div class="message_inline_image"><a href="/user_uploads/4715/v8tpIj6bP0te7uXwpaCo48Xv/image.DNXJY0.png" title="image.DNXJY0.png"><img src="/user_uploads/4715/v8tpIj6bP0te7uXwpaCo48Xv/image.DNXJY0.png"></a></div><p>I've made a diagram of the big compiler stages based on the data flow. My plan is to add this to the <a href="https://rustc-dev-guide.rust-lang.org/overview.html">overview chapter</a> in the dev guide.</p>
<p>I'd like some feedback: Have I missed something? Are the terms correct? <br>
The things on the right are examples of what is done in a stage, and is not meant to be complete. Do you know other important ones?</p>
<p>Also, do you know a good tool to draw this digitally? Ideally a website, where one can edit it later and produce a PNG or SVG file.</p>



<a name="226249732"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Overview%20diagram/near/226249732" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Overview.20diagram.html#226249732">(Feb 13 2021 at 15:20)</a>:</h4>
<p>It is roughly correct. I don't think you have mixed any IR. The biggest thing that is different in reality is that several stages have more of a cyclic dependency. For example macro expansion can cause additional files to be lexed and parsed. MIR generation of a function requires typechecking of said function, which can itself require the MIR of different functions for const eval. In addition just like lexing and parsing are happening interleaved, generation of THIR happens on the fly while lowering to MIR. At no point in time does the whole THIR of a function exist. A HIR body is lazily lowered to THIR as necessary for MIR lowering. This doesn't become clear from the diagram, though admittedly it may not be very relevant. The final remark I have is that everything after AST-&gt;HIR lowering heavily uses the query system. Not just HIR-&gt;THIR.</p>



<a name="226250053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Overview%20diagram/near/226250053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Julian-Wollersberger <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Overview.20diagram.html#226250053">(Feb 13 2021 at 15:28)</a>:</h4>
<p>I'll remove the remark about the query system then. <br>
The cyclic dependencies are hard to draw. I'll add an arrow from SyntaxTree to lexing, and one from MIR to HIR.<br>
Maybe drawing the THIR box with a dotted border will help.</p>



<a name="226285284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Overview%20diagram/near/226285284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Overview.20diagram.html#226285284">(Feb 14 2021 at 04:33)</a>:</h4>
<blockquote>
<p>Also, do you know a good tool to draw this digitally? Ideally a website, where one can edit it later and produce a PNG or SVG file.</p>
</blockquote>
<p>Not a free tool, but Adobe Illustrator might work.</p>



<a name="226285322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Overview%20diagram/near/226285322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Overview.20diagram.html#226285322">(Feb 14 2021 at 04:34)</a>:</h4>
<p>I haven't used it much, but GIMP—which is free and open-source—may also work. (It's more like Photoshop and less like Illustrator IIUC though.)</p>



<a name="226293519"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Overview%20diagram/near/226293519" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Overview.20diagram.html#226293519">(Feb 14 2021 at 08:42)</a>:</h4>
<p>Inkscape is an open source vector editor.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>